/**
 * @since : 2018/3/26 下午4:11
 * @author : fupeng
 */

import Mutil from 'util/mm.jsx';

const _mm = new Mutil();

class User {

    login(userInfo) {
        return _mm.request({
            url: '/manage/user/login.do',
            type: 'POST',
            data: {
                username: userInfo.username,
                password: userInfo.password
            }
        });
    }

    checkUserInfo(userInfo) {
        let username = $.trim(userInfo.username);
        let password = $.trim(userInfo.password);
        if (typeof username !== 'string' || username.length <= 0) {
            return {
                status: false,
                msg: "用户名不能为空"
            }
        }
        if (typeof password !== 'string' || password.length <= 0) {
            return {
                status: false,
                msg: "密码不能为空"
            }
        }
        return {
            status: true,
            msg: "检测完成"
        }
    }

}

export default User;